/* 头部布局 - 使用合理的flex布局避免过大间距 */
.header-grid {
    display: flex;
    align-items: center;
    height: 64px;
    gap: 1rem; /* 使用固定间距而不是space-between */
}

.header-logo {
    flex: 0 0 auto;
    /* width: 200px; */
}

.header-nav {
    flex: 0 0 auto;
    margin-left: 1rem; /* 减少左边距 */
}

.header-search {
    flex: 1 1 auto;
    max-width: 300px; /* 稍微增加搜索框最大宽度 */
    margin-left: auto; /* 推到右侧 */
    margin-right: 1rem;
}

.header-user {
    flex: 0 0 auto;
    width: 200px;
    display: flex;
    justify-content: flex-end;
}

/* 响应式调整 */
@media (max-width: 1024px) {
    .header-logo {
        width: 150px;
    }

    .header-nav {
        display: none !important;
    }

    .header-search {
        margin: 0 1rem;
    }

    .header-user {
        width: 150px;
    }
}

@media (max-width: 768px) {
    .header-logo {
        width: 120px;
    }

    .header-search {
        margin: 0 0.5rem;
        max-width: 250px;
    }

    .header-user {
        width: 120px;
    }
}

/* 全局商品图片样式 */
.goods-item-image {
    width: 100%;
    height: 130px;
    object-fit: cover;
}

/* 商品网格布局 - 已移除，使用下方统一的响应式网格 */

/* 主题样式已移除，使用Tailwind CSS原生类 */

/* 响应式布局已通过Tailwind CSS类实现 */

/* 下拉菜单样式 */
.group:hover .group-hover\:opacity-100 {
    opacity: 1 !important;
}

.group:hover .group-hover\:visible {
    visibility: visible !important;
}

.group:hover .group-hover\:rotate-180 {
    transform: rotate(180deg) !important;
}

/* 分类下拉菜单 - 修复悬停问题 */
nav .group:hover > div.absolute,
nav .group > div.absolute:hover,
nav .group:focus-within > div.absolute {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* 确保下拉菜单容器有正确的初始状态 */
nav .group > div.absolute {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.15s ease;
    /* 减少菜单和按钮之间的间隙 */
    margin-top: 2px;
}

/* 确保下拉菜单在悬停时保持显示 */
nav .group {
    position: relative;
}

nav .group > div.absolute {
    /* 扩展悬停区域，避免鼠标移动时菜单消失 */
    padding-top: 2px;
    margin-top: 0;
}

/* 箭头旋转动画 */
nav .group:hover .fa-chevron-down {
    transform: rotate(180deg);
}

/* 分类菜单项样式 */
.category-menu-item {
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f4;
}

.category-menu-item:last-child {
    border-bottom: none;
}

.category-parent-link {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    position: relative;
}

.category-parent-link:hover {
    background-color: #f8fafc;
    color: #3b82f6;
    transform: translateX(2px);
}

/* 父分类图标样式已移到JavaScript中动态生成 */

.category-children {
    margin-left: 16px;
    padding-left: 12px;
    border-left: 2px solid #e2e8f0;
    background-color: #fafbfc;
    border-radius: 4px;
    padding-top: 4px;
    padding-bottom: 4px;
}

.category-child-link {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #64748b;
    text-decoration: none;
    padding: 4px 10px;
    margin-bottom: 2px;
    border-radius: 4px;
    transition: all 0.2s ease;
    position: relative;
}

.category-child-link:hover {
    background-color: #e0f2fe;
    color: #0369a1;
    transform: translateX(3px);
}

/* 子分类图标样式已移到JavaScript中动态生成 */

/* 下拉菜单整体样式优化 */
nav .group > div.absolute {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
}

/* 用户菜单下拉 */
#user-dropdown.show {
    opacity: 1 !important;
    visibility: visible !important;
}



/* 文本截断 */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 价格字体 */
.price-font {
    font-family: 'Arial', 'Helvetica', sans-serif;
    font-weight: bold;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
